from pydantic_settings import BaseSettings
from functools import lru_cache

class JwtSettings(BaseSettings):
    
    SECRET_KEY: str = "3488a63e1765035d386f05409663f55c83bfae3b3c61a932744b20ad14244dcf"  # openssl rand -hex 32
    JWT_ALGORITHM: str = "HS256"
    JWT_EXPIRE_MINUTES: int = 60 * 24 * 7  # 7 day
    DEFAULT_EXPIRE_MINUTES: int = 30
    JWT_REDIS_EXPIRE_MINUTES: int = 30
    
@lru_cache
def get_jwt_settings():
    """读取配置优化写法"""
    return JwtSettings()

JwtConfig = get_jwt_settings()